From 2d2a81f6da5c41fca4bc56fac9918e652ebee763 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Thu, 26 Jul 2007 19:03:07 +0000 Subject: [PATCH] trackfilter: Allow 'range' together with trackpoints without timestamp. --- trackfilter.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/trackfilter.c b/trackfilter.c index 408d64ebd..7f5676c27 100644 --- a/trackfilter.c +++ b/trackfilter.c @@ -32,6 +32,7 @@ 2006-06-01: Add name option 2007-01-08: if not really needed disable check for valid timestamps (based on patch from Vladimir Kondratiev) + 2007-07-26: Allow 'range' together with trackpoints without timestamp */ #include @@ -799,7 +800,7 @@ trackfilter_range(void) /* returns number of track points left after filtering { time_t start, stop; queue *elem, *tmp; - int i, dropped; + int i, dropped, inside = 0; if (opt_start != 0) start = trackfilter_range_check(opt_start); @@ -811,7 +812,7 @@ trackfilter_range(void) /* returns number of track points left after filtering else stop = 0x7FFFFFFF; - dropped = 0; + dropped = inside = 0; for (i = 0; i < track_ct; i++) { @@ -821,8 +822,11 @@ trackfilter_range(void) /* returns number of track points left after filtering { waypoint *wpt = (waypoint *)elem; - if ((wpt->creation_time < start) || (wpt->creation_time > stop)) - { + if (wpt->creation_time > 0) { + inside = ((wpt->creation_time >= start) && (wpt->creation_time <= stop)); + } + + if (! inside) { track_del_wpt(track, wpt); waypt_free(wpt); dropped++; @@ -861,7 +865,7 @@ trackfilter_init(const char *args) */ need_time = ( opt_merge || opt_pack || opt_split || opt_sdistance || - opt_move || opt_start || opt_stop || opt_fix || opt_speed || + opt_move || opt_fix || opt_speed || (trackfilter_opt_count() == 0) /* do pack by default */ ); /* in case of a formated title we also need valid timestamps */ -- 2.30.2